package com.zy.hash.consistent;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Objects;

/**
 * @author zhaoyi
 * @date 2021/7/21 15:13
 * 普通的map模拟 缓存节点
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class CacheNode extends HashMap<String, Object> {
    private String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        CacheNode cacheNode = (CacheNode) o;
        return Objects.equals(name, cacheNode.name);
    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }
}
